package com.example.myproject.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ApiResponse<T> {
    private int code;
    private String message;
    private T data;

    public static <T> ApiResponse<T> success(int code, String msg, T d) {
        return new ApiResponse<>(code, msg, d);
    }
    public static <T> ApiResponse<T> success(int code, String msg) {
        return new ApiResponse<>(code, msg, null);
    }
    public static <T> ApiResponse<T> error(int code, String msg) {
        return new ApiResponse<>(code, msg, null);
    }
}
